﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Windvoice.Blog.Services.DataContract;
using Windvoice.Blog.Services.DataContract.Traslator;
using Windvoice.Framework.Service;

namespace Windvoice.Blog.Services
{
    public class BlogService : WindvoiceServiceBase , IBlogService
    {
        public ArticleDataContract[] GetArticles(int pageIndex, int pageSize, int categoryID, out int recordCount)
        {
            var query = from a in Article.GetList(pageIndex, pageSize, categoryID, out recordCount) select ArticleTranslator.Translat(a);
            return query.ToArray();
        }

        public ArticleDataContract GetArticle(int articleID)
        {
            return ArticleTranslator.Translat(Article.Find(articleID));
        }
    }
}
